package com.dp.factory.service.abstractFactory;

import com.dp.factory.service.Color;
import com.dp.factory.service.Shape;
import com.dp.factory.service.impl.Circle;
import com.dp.factory.service.impl.Rectangle;
import com.dp.factory.service.impl.Square;

/**
 * <p>Title: ShapeFactory</p>
 * <p>Description: </p>
 * <p>Copyright: Copyright (c) 2018</p>
 * <p>Company: wylCloud.com</p>
 *
 * @author wangyl
 * @version 1.0
 * @date 2020/7/2
 */
public class ShapeFactory extends AbstractFactory {

    public static final String CIRCLE = "CIRCLE";

    public static final String RECTANGLE = "RECTANGLE";

    public static final String SQUARE = "SQUARE";

    /***
     * 画笔
     * @param shapeType 形状
     * @return 形状对象
     */
    @Override
    public Shape getShape(String shapeType) {
        if (shapeType == null) {
            return null;
        }
        if (CIRCLE.equalsIgnoreCase(shapeType)) {
            return new Circle();
        } else if (RECTANGLE.equalsIgnoreCase(shapeType)) {
            return new Rectangle();
        } else if (SQUARE.equalsIgnoreCase(shapeType)) {
            return new Square();
        }
        return null;
    }

    /***
     *  填充颜色
     * @param color 颜色
     * @return 颜色对象
     */
    @Override
    public Color getColor(String color) {
        return null;
    }
}
